<template>
	<view class="main">
		<view v-for="item in allState.list" :key="item.userid" class="flex flex-ai-c list" @click="skip(item)">
			<view class="head-img">
				<image :src="item.headimg || '../../static/img/headimg.jpg'"></image>
			</view>
			<view class="right">
				<view>{{item.username}}</view>
				<view>{{item.sign}}</view>
				<view></view>
			</view>
		</view>
		<view style="height: 100%;" v-if="!allState.list.length">
			<u-empty text="数据为空" mode="list"></u-empty>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import {reactive} from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	import user from '@/api/user.js'
	let allState = reactive({
		list: [],
		userinfo: uni.getStorageSync('userinfo')
	})
	const skip = (item: any) => {
		uni.navigateTo({
			url: `/pages_home/personalInfo/index?id=${item.userid}`
		})
	}
	const getList = async (id: number|string) =>{
		const res = await user.getUserList({
			type: 2,
			userid: id
		})
		allState.list  = res.data
	}
	onLoad((op)=>{
		let id = op.id ? op.id : ''
		getList(id)
	})
</script>

<style lang="scss" scoped>
	page{
		height: 100%;
	}
	.main{
		height: 100%;
		.list{
			padding: 20rpx;
			border-bottom: 1px solid gainsboro;
		}
		.right{
			margin-left: 20rpx;
		}
	}
</style>